package com.wuyan.locationdog.adapter

import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.LayoutRes
import com.arcsoft.commonbase.bean.DeviceShareBeanContent
import com.arcsoft.commonbase.ext.loadImageCircleCar
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.wuyan.locationdog.R
import com.wuyan.locationdog.help.DeviceHelp


class DeviceShareListAdapter(@LayoutRes layoutResId: Int, data: MutableList<DeviceShareBeanContent>?) :
    BaseQuickAdapter<DeviceShareBeanContent, BaseViewHolder>(layoutResId, data) {

    var type = ""

    override fun convert(holder: BaseViewHolder, item: DeviceShareBeanContent) {
        holder.apply {
            getView<TextView>(R.id.deviceName).text = DeviceHelp.getDeviceName(item)
            getView<TextView>(R.id.imei).text = "设备ID："+item.imei
            if (type == "接受") {
                getView<TextView>(R.id.shareCount).text = "来自"+item.userCode
                getView<TextView>(R.id.acceptTime).text = item.acceptTime

            } else {
                getView<TextView>(R.id.shareCount).text = "已共享给"+item.shareCount+"位好友"

            }

            val imageView = getView<ImageView>(R.id.deviceAvatarUrl)
            imageView.loadImageCircleCar(item.dogImg)

        }
    }
}


